package com.L1ngg;

import java.util.Random;

public class text11 {
    public static void main(String[] args) {
        int[][] array = generatearray(10,10);

        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                System.out.print(array[i][j] + " ");
            }
            System.out.println(" ");
        }

        int max = array[0][0];
        int maxrow = 0;
        int maxcol = 0;
        for (int i = 0; i < 10; i++)
            for(int j = 0; j < 10; j++){
                if(array[i][j] > max){
                    max = array[i][j];
                    maxrow = i;
                    maxcol = j;
                }
            }
        System.out.println("最大值是:"+max+"在第"+(maxrow+1)+"行第"+(maxcol+1)+"列");


    }
    public static int[][] generatearray(int rows,int columns){
        // 创建一个Random对象
        Random random = new Random();
        // 创建一个10x10的数组
        int[][] array = new int[rows][columns];
        // 遍历数组
        for (int i = 0; i < rows; i++) {
            for (int j = 0; j < columns; j++) {
                // 将数组中的每个元素随机赋值为1-100之间的数
                array[i][j] = random.nextInt(100) + 1;
            }
        }
        return array;
    }
}
